package com.git_taoxian.test2;

import java.util.HashMap;
import java.util.Set;
import java.util.function.BiConsumer;

public class Test {
    public static void main(String[] args) {
//        定义两个内部HashMap集合用于存储班级学生信息
        HashMap<String, String> hashMap1 = new HashMap<>();
        hashMap1.put("001","李晨");
        hashMap1.put("002","范冰冰");
        hashMap1.forEach((s, s2) -> System.out.print(s+","+s2+" "));//打印结果
        System.out.println();
        HashMap<String, String> hashMap2 = new HashMap<>();
        hashMap2.put("001","马云");
        hashMap2.put("002","马化腾");
        hashMap2.forEach((s, s2) -> System.out.print(s+","+s2+" "));//打印结果
        System.out.println();
//        定义一个外部HashMap集合用于嵌套
        HashMap<String, HashMap<String,String>> hashMap = new HashMap<>();
        hashMap.put("Java基础班",hashMap1);
        hashMap.put("Java就业班",hashMap2);
        hashMap.forEach(new BiConsumer<String, HashMap<String, String>>() {
            @Override
            public void accept(String s, HashMap<String, String> stringStringHashMap) {
                System.out.println(s);
                stringStringHashMap.forEach(new BiConsumer<String, String>() {
                     @Override
                     public void accept(String s, String s2) {
                         System.out.println(s+","+s2);
                     }
                 });
            }
        });
    }
}
